//region simpleSplitString
/**
 * 简单的把字符串分成2个字符串
 * @param str		分割的字符串
 * @param separator	分隔符
 * @return			字符串数组
 */
function simpleSplitString(str:string,separator:string):[string,string]{
	const pos=str.indexOf(separator);
	if(pos===-1){
		return [str,''];
	}
	return [str.slice(0,pos),str.slice(pos+separator.length)];
}
//endregion
//region replaceString
/**
 * 字符串替换
 * @param src		原始字符串
 * @param search	搜索值
 * @param replace	替换值
 * @return 替换后的字符串
 */
function replaceString(src:string,search:string,replace:string):string{
	let pos=0;
	let next=src.indexOf(search);
	let str='';
	while(next!==-1){
		str+=src.slice(pos,next)+replace;
		pos=next+search.length;
		next=src.indexOf(search,pos);
	}
	return str+src.slice(pos);
}
//endregion
export {
	simpleSplitString,
	replaceString,
};